// Steve不能依赖注入到模块中，生产环境构建
// { provide: Steve, useValue: window.steve} 会被移除，现在不清楚为什么
export class Steve {
  config: Map<string, any> = new Map();
  private globalObjectKey = '_steve_global_object';

  public getGlobalItem(key: string) {
    return window[this.globalObjectKey] ? window[this.globalObjectKey][key] : null;
  }

  public setGlobalItem(key: string, value: any) {
    if (!window[this.globalObjectKey]) {
      window[this.globalObjectKey] = {};
    }
    value ? window[this.globalObjectKey][key] = value : delete window[this.globalObjectKey][key];
  }
}



const steve = (window as any).steve;
if (!(steve instanceof Steve)) {
  (window as any).steve = new Steve();
}
